﻿<UserControl x:Class="TFhisto.UI.ChangesetHistory"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:my="clr-namespace:Wpf.Controls;assembly=Wpf.SplitButton" 
             xmlns:my1="clr-namespace:TFhisto.UI" 
             mc:Ignorable="d" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <UserControl.Resources>
        <ResourceDictionary>
        	<ResourceDictionary.MergedDictionaries>
        		<ResourceDictionary Source="ResourceDictionary1.xaml"/>
        	</ResourceDictionary.MergedDictionaries>
            <DataTemplate x:Key="SelectionColumn">
                <Label>
                    <Label.Content>
                        <CheckBox IsChecked="{Binding Path=Selected}" />
                    </Label.Content>
                </Label>
            </DataTemplate>
            <DataTemplate x:Key="SelectionHeaderColumn">
                <Label>
                    <Label.Content>
                        <CheckBox Checked="CheckAll" Unchecked="UncheckAll" />
                    </Label.Content>
                </Label>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    
    <Grid Background="{DynamicResource BrushPurple2Blue3}" MaxHeight="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Grid, AncestorLevel=1}, Path=ActualHeight }">
        <Grid.RowDefinitions>
            <RowDefinition MinHeight="135" Height="*" />
            <RowDefinition Height="Auto" />
            <RowDefinition MinHeight="180" Height="*" />
            <RowDefinition Height="23" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="220" Width="*" />
        </Grid.ColumnDefinitions>

        <my:SplitButton Content="Generate Report" Foreground="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" Height="24" HorizontalAlignment="Right" Margin="0,5,5,0" x:Name="splitBtnWorkItem" VerticalAlignment="Top" Width="123" Click="btnChangeset_Click">
            <my:SplitButton.Background>
                <SolidColorBrush Color="{DynamicResource Purple1}"/>
            </my:SplitButton.Background>
            <MenuItem Header="Visualize" Click="btnChangeset_Click"/>
            <MenuItem Header="Group by">
                <MenuItem Header="Branch" CommandParameter="Branch" Click="btnChangeset_Click" />
            </MenuItem>
        </my:SplitButton>

        <Grid Margin="5,25,5,0" VerticalAlignment="Top" Grid.Row="0">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="51" />
                <RowDefinition Height="55" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition MinWidth="210" Width="*"/>
            </Grid.ColumnDefinitions>

            <GroupBox Grid.Row="0" Header="                            " Margin="0,0,0,0" Name="groupBox2" Height="Auto" VerticalAlignment="Top" VerticalContentAlignment="Stretch" Width="Auto" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
            	<GroupBox.BorderBrush>
            		<SolidColorBrush Color="{DynamicResource Blue3}"/>
            	</GroupBox.BorderBrush>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="35" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                        <ListBox IsEnabled="False" Margin="2,0" Name="lstSelectedFiles" OverridesDefaultStyle="False" MinHeight="24" VerticalContentAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" BorderBrush="{x:Null}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid Name="SelectedFilesList">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition />
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <CheckBox Grid.Column="0" IsChecked="{Binding Path=Checked}" VerticalAlignment="Center" />
                                    <Label Content="{Binding Path=FileName}" Grid.Column="1" ToolTip="{Binding Path=FullPath}" IsEnabled="{Binding Path=Selected}" />
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                    <RadioButton Content="Search by File" Height="16" Margin="6,-14,-6,0" Name="rbSearchByFile" VerticalAlignment="Top" Checked="rbSearchByFile_Checked" GroupName="Search" BorderBrush="{x:Null}" d:LayoutOverrides="Width" Grid.ColumnSpan="2" />
                        <ToolBarPanel Grid.Row="0" Height="24" HorizontalAlignment="Left" Margin="5,5,0,0" Name="toolBarPanel1" VerticalAlignment="Top" Width="164" Orientation="Horizontal" d:LayoutOverrides="HorizontalAlignment">
                        <Button  Name="BtnAddItem" IsEnabled="False" Click="AddItem_Click" ToolTip="Add a file manually">
                        	<Button.Background>
                        		<SolidColorBrush Color="{DynamicResource Purple2}"/>
                        	</Button.Background>
                            <Image Source="..\Graphics\Add.ico"/>
                        </Button>
                        <Button  Name="BtnEditItem" IsEnabled="False" Click="EditItem_Click" ToolTip="Edit a file" Margin="3,0,0,0">
                        	<Button.Background>
                        		<SolidColorBrush Color="{DynamicResource Purple2}"/>
                        	</Button.Background>
                            <Image Source="..\Graphics\Pencil.ico"></Image>
                        </Button>
                        <Button  Name="BtnSelectAllItems" IsEnabled="False" Click="SelectAllItems_Click" ToolTip="Select/Unselect all files" Margin="3,0,0,0">
                            <Button.Background>
                                <SolidColorBrush Color="{DynamicResource Purple2}"/>
                            </Button.Background>
                            <Image Source="..\Graphics\CheckBoxes.ico"></Image>
                        </Button>
                        <Button  Margin="3,0,0,0" Name="BtnRemoveItem" IsEnabled="False" Click="RemoveItem_Click" ToolTip="Remove Selected items from the list">
                            	<Button.Background>
                            		<SolidColorBrush Color="{DynamicResource Purple2}"/>
                            	</Button.Background>
                                <Image Source="..\Graphics\Erase.ico"></Image>
                            </Button>
                        <Button  Margin="3,0,0,0" Name="BtnSelectItem" IsEnabled="False" Click="SelectItem_Click" ToolTip="Include Selected items to the report">
                            	<Button.Background>
                            		<SolidColorBrush Color="{DynamicResource Purple2}"/>
                            	</Button.Background>
                                <Image Source="..\Graphics\OK.ico"></Image>
                            </Button>
                        <Button  Margin="3,0,0,0" Name="BtnUnselectItem" IsEnabled="False" Click="UnselectItem_Click" ToolTip="Exclude Selected items from the report">
                            	<Button.Background>
                            		<SolidColorBrush Color="{DynamicResource Purple2}"/>
                            	</Button.Background>
                                <Image Source="..\Graphics\Cancel.ico"></Image>
                            </Button>
                        </ToolBarPanel>
                    </Grid>
            </GroupBox>
            <GroupBox Grid.Row="1" Header="                                             " VerticalAlignment="Top" VerticalContentAlignment="Stretch" Margin="0,0,0,0" Name="groupBox3" Width="Auto" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
            	<GroupBox.BorderBrush>
            		<SolidColorBrush Color="{DynamicResource Blue3}"/>
            	</GroupBox.BorderBrush>
                <Grid Height="Auto">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="46*" />
                    </Grid.ColumnDefinitions>
                    <RadioButton Content="Search by Changeset ID" Height="16" Margin="6,-11,140.423,0" Name="rbSearchByChangesetID" VerticalAlignment="Top" Checked="rbSearchByChangesetID_Checked" GroupName="Search" d:LayoutOverrides="GridBox" BorderBrush="{x:Null}" />
                    <TextBox Height="23" HorizontalAlignment="Left" Margin="0,7,0,0" Name="txbChangesetID" VerticalAlignment="Top" Width="89" BorderBrush="{x:Null}" />
                    <Button Content="Load Branches..." Height="23" HorizontalAlignment="Right" Margin="0,3,0,0" Name="btnLoadBranches" VerticalAlignment="Top" Width="104" Click="btnLoadBranches_Click" FontWeight="Black">
                        <Button.Foreground>
                            <SolidColorBrush Color="{DynamicResource Purple1}"/>
                        </Button.Foreground>
                        <Button.BorderBrush>
                    		<SolidColorBrush Color="{DynamicResource Purple1}"/>
                    	</Button.BorderBrush>
                    	<Button.Background>
                    		<SolidColorBrush Color="{DynamicResource Purple2}"/>
                    	</Button.Background>
                    </Button>
                    <TextBlock Height="29" HorizontalAlignment="Left" Margin="92,4,0,0" Name="txbChangesetIDErrorMessage" Text="Invalid number format" VerticalAlignment="Top" Width="82" TextWrapping="Wrap" TextAlignment="Center" Foreground="Red" Visibility="Hidden" />
                </Grid>
            </GroupBox>
            <GroupBox Grid.Row="2" Header="Location of output file:" VerticalAlignment="Top" VerticalContentAlignment="Stretch" Name="groupBox1">
            	<GroupBox.BorderBrush>
            		<SolidColorBrush Color="{DynamicResource Blue3}"/>
            	</GroupBox.BorderBrush>
                <Grid>
                    <TextBox Height="23" Margin="0,6,55,0" Name="txtOutput" Text="C:\Users\tfssetup\Documents\Output.dgml" VerticalAlignment="Top" BorderBrush="{x:Null}" />
                    <Button Content="Browse" Height="23" HorizontalAlignment="Right" Margin="0,5,0,0" Name="btnBrowse" VerticalAlignment="Top" Width="49" Click="btnBrowse_Click" >
                    	<Button.BorderBrush>
                    		<SolidColorBrush Color="{DynamicResource Blue1}"/>
                    	</Button.BorderBrush>
                    	<Button.Background>
                    		<SolidColorBrush Color="{DynamicResource Blue3}"/>
                    	</Button.Background>
                    </Button>
                </Grid>
            </GroupBox>
        </Grid>

        <GridSplitter Height="5" HorizontalAlignment="Stretch" Name="gridSplitter1" VerticalAlignment="Stretch" ResizeDirection="Rows" ShowsPreview="True" HorizontalContentAlignment="Stretch" Grid.Row="1" VerticalContentAlignment="Stretch" >
        	<GridSplitter.Background>
        		<SolidColorBrush Color="{DynamicResource Purple1}"/>
        	</GridSplitter.Background>
        </GridSplitter>
        
        <TabControl Grid.Row="2" Margin="0,3,0,0" Background="White" Name="tabControl1" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" Width="Auto" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
            <TabControl.Resources>
                <Style TargetType="{x:Type TabItem}">
                    <Style.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                                        <GradientStop Color="#FFF3F3F3" Offset="0"/>
                                        <GradientStop Color="#FFF11818" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </TabControl.Resources>
            <TabControl.BorderBrush>
                <SolidColorBrush Color="{DynamicResource Blue1}"/>
            </TabControl.BorderBrush>
            <TabItem Header="1 > Branches" Name="tabBranches" Foreground="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" BorderBrush="{x:Null}">
                <TabItem.Background>
                    <SolidColorBrush Color="{DynamicResource Purple1}"/>
                </TabItem.Background>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" BorderThickness="0">
                    <Grid>
                        <ListView MinHeight="150" Name="lstResults">
                            <ListView.View>
                                <GridView ColumnHeaderContainerStyle="{DynamicResource ResultHeaderStyleBlue}"></GridView>
                            </ListView.View>
                        </ListView>
                    </Grid>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="2 > Filters" Name="tabFilters" BorderBrush="{x:Null}" Tag="1">
                <TabItem.Background>
                    <SolidColorBrush Color="{DynamicResource Purple2}"/>
                </TabItem.Background>
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto" BorderThickness="0">
                    <Grid>
                        <Label Content="Error message" Foreground="Red" Height="28" HorizontalAlignment="Left" Margin="0,0,0,0" Name="filterErrorMessage" VerticalAlignment="Top" Visibility="Hidden" />
                        <GroupBox Header="Changeset DATE must be between:" Height="57" Margin="5,25,5,5" Name="filterDateGroup" VerticalAlignment="Top" >
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MinWidth="120" Width="0.5*" />
                                    <ColumnDefinition MinWidth="120" Width="0.5*" />
                                </Grid.ColumnDefinitions>
                                <Label Grid.Column="0" Content="Before:" Height="28" HorizontalAlignment="Left" Margin="0,7,0,0" Name="label2" VerticalAlignment="Top" />
                                <DatePicker Grid.Column="0" Height="25" HorizontalAlignment="Right" Margin="0,7,0,0" Name="filterDateFrom" VerticalAlignment="Top" />
                                <Label Grid.Column="1" Content="After:" Height="28" HorizontalAlignment="Left" Margin="0,7,0,0" Name="label5" VerticalAlignment="Top"  />
                                <DatePicker Grid.Column="1" Height="25" HorizontalAlignment="Right" Margin="0,7,0,0" Name="filterDateTo" VerticalAlignment="Top" />
                            </Grid>
                        </GroupBox>
                        <GroupBox Header="Changeset ID must be between:" Height="57" Margin="5,90,5,5" Name="filterIDGroup" VerticalAlignment="Top" >
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition MinWidth="120" Width="0.5*" />
                                    <ColumnDefinition MinWidth="120" Width="0.5*" />
                                </Grid.ColumnDefinitions>
                                <Label Grid.Column="0" Content="To:" Height="28" HorizontalAlignment="Left" Margin="0,7,0,0" Name="label3" VerticalAlignment="Top" />
                                <TextBox Grid.Column="0" HorizontalAlignment="Right" Margin="0,7,0,0" Name="filterChangesetFrom" VerticalAlignment="Top" Width="66" />
                                <Label Grid.Column="1" Content="From:" Height="28" HorizontalAlignment="Left" Margin="0,7,0,0" Name="label4" VerticalAlignment="Top"  />
                                <TextBox Grid.Column="1" Height="23" HorizontalAlignment="Right" Margin="0,7,0,0" Name="filterChangesetTo" VerticalAlignment="Top" Width="66" />
                            </Grid>
                        </GroupBox>

                        <GroupBox Header="Change TYPE must be:" Height="Auto" Margin="5,152,5,0" Name="filterLinkTypeGroup" VerticalAlignment="Top" >
                            <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="0,5,0,0" HorizontalScrollBarVisibility="Auto" Width="Auto">
                                <Grid>
                                    <ListBox Name="lstChangeTypes" DockPanel.Dock="Top" OverridesDefaultStyle="False" MinHeight="75">
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <Grid Name="ChangeTypeList">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="*"/>
                                                    </Grid.RowDefinitions>
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="30"/>
                                                        <ColumnDefinition Width="*"/>
                                                    </Grid.ColumnDefinitions>
                                                    <CheckBox Grid.Column="0" IsChecked="{Binding Path=Selected}" IsEnabled="{Binding Path=Enabled}" VerticalAlignment="Center"></CheckBox>
                                                    <Label Grid.Column="1" Content="{Binding Path=LinkType}"></Label>
                                                </Grid>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>
                                </Grid>
                            </ScrollViewer>
                        </GroupBox>
                    </Grid>
                </ScrollViewer>
            </TabItem>
            <TabItem Header="3 > Options" Name="tabOptions" BorderBrush="{x:Null}" Tag="2">
                <TabItem.Background>
                    <SolidColorBrush Color="{DynamicResource Purple3}"/>
                </TabItem.Background>
                <Grid>
                    <CheckBox Content="Show change files within Changesets" IsChecked="False" Height="16" HorizontalAlignment="Left" Margin="5,10,0,0" Name="chkShowFiles" VerticalAlignment="Top" Checked="chkShowFiles_Checked" Unchecked="chkShowFiles_Unchecked" />
                    <CheckBox Content="Group files" IsChecked="False" Height="16" HorizontalAlignment="Left" Margin="15,35,0,0" Name="chkGroupFiles" VerticalAlignment="Top" IsEnabled="False" />
                    <CheckBox Content="Show labels" IsChecked="False" Height="16" HorizontalAlignment="Left" Margin="5,70,0,0" Name="chkShowLabels" VerticalAlignment="Top" IsEnabled="True" Checked="chkShowLabels_Checked" Unchecked="chkShowLabels_Unchecked"/>
                    <CheckBox Content="Show comments in changeset" Height="16" HorizontalAlignment="Left" IsChecked="False" Margin="5,130,0,0" Name="chkShowComments" VerticalAlignment="Top"  />
                    <CheckBox Content="Show associated Work Items" Height="16" HorizontalAlignment="Left" IsChecked="False" Margin="5,160,0,0" Name="chkShowWI" VerticalAlignment="Top"  />
                    <TextBox Height="23" Margin="60,92,10,0" Name="txbLabelPattern" VerticalAlignment="Top" Width="Auto" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsEnabled="False"></TextBox>
                    <Label Content="Pattern:" Height="28" HorizontalAlignment="Left" Margin="10,91,0,0" Name="label1" VerticalAlignment="Top" />
                </Grid>
            </TabItem>
        </TabControl>

        <StatusBar Grid.Row="3" Height="23" Foreground="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="statusBar" VerticalAlignment="Top">
            <StatusBarItem >
            	<StatusBarItem.Background>
            		<SolidColorBrush Color="{DynamicResource Purple1}"/>
            	</StatusBarItem.Background>
            </StatusBarItem>
        </StatusBar>
    </Grid>
</UserControl>
